package com.example.auth.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.example.annotations.Autowired;
import com.example.annotations.Service;
import com.example.auth.model.LoginLog;
import com.example.auth.service.LoginLogService;
import com.example.db.DBSql;
import com.example.db.SqlBuilder;
import com.example.db.TableService;
import com.example.db.model.IPage;

/**
 * @Classname LoginLogServiceImpl
 * @Description TODO
 * @Date 2022/8/13 12:14
 * @Created by XiongXiong
 * @Author: X.I.O
 */
@Service
public class LoginLogServiceImpl implements LoginLogService {

    @Autowired
    DBSql dbSql;

    @Autowired
    TableService tableService;

    @Override
    public IPage<LoginLog> page(Integer pageNum, Integer pageSize, JSONObject object) {
        SqlBuilder sqlBuilder=tableService.getSqlBuilder(LoginLog.class);
        if(object != null){

        }
        sqlBuilder.orderByDesc("createdate");
        sqlBuilder.page(pageNum,pageSize);
        return tableService.getPage(sqlBuilder,LoginLog.class);
    }

    @Override
    public LoginLog save(LoginLog loginLog) {
        tableService.save(loginLog,LoginLog.class);
        return loginLog;
    }
}
